#import <Foundation/Foundation.h>

/**
 * A PersistentDataType is a protocol for a data type that is
 * stored on disk.
 *
 * @author      James Lin
 * @version     0.4.1
 * @since       0.3.1
 */
@protocol PersistentDataType <NSCoding>

/**
 * Compute a unique key for the data type.
 *
 * The key can be single or composite, but must result in
 * a unique identifier.
 *
 * @return  the unique key
 */
- (NSString*)getKey;

/**
 * Encodes the persistent data type for archiving options.
 *
 * Must at least support keyed archiving. Non-keyed archiving
 * is optional but recommended for backward support.
 *
 * @param coder  the NSCoder used for encoding
 */
- (void)encodeWithCoder:(NSCoder*)coder;

/**
 * Initializes the persistent data type from archive.
 *
 * Must at least support keyed archiving. Non-keyed archiving
 * is optional but recommended for backward support.
 *
 * @param coder  the NSCoder used for decoding
 * @return       the persistent data type decoded from archive
 */
- (id)initWithCoder:(NSCoder*)coder;

@end
